import time
from public.action import *
from public.business import *
from public.testData import *
from public.tools import *
testCase = "DBshop021_添加品牌"

# 调用函数 实例化浏览器对象 打开指定网址
driver = openBrowser(urlAdmin)
# 调用函数登录后台
DBshopLoginAdmin(driver)
# 处理三级菜单
DBshopEnterMenu2(driver,'商品管理','商品品牌')
driver.find_element_by_link_text("添加品牌").click()
driver.find_element_by_id("brand_name").send_keys(pinpai)
driver.find_element_by_xpath("//button").click()

try:
    driver.find_element_by_xpath('//td[contains(.,"%s")]'%pinpai).is_displayed()
    writeLog("%s 测试通过"%testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(driver)
driver.quit()
